﻿<style type="text/css">
    .auto-style1 {
        width: 400px;
    }

    .easyui-textbox {
        width: 430px;
    }

    .auto-style2 {
        width: 150px;
    }

    .easyui-combobox {
        width: 430px;
    }
</style>
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <title>审核管理</title>
    <link href="~/css/css_1.css" rel="stylesheet" />
    <link rel="stylesheet" type="text/css" href="../../easyUI/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../../easyUI/themes/icon.css">
    <script type="text/javascript" src="../../easyUI/jquery.min.js"></script>
    <script type="text/javascript" src="../../easyUI/jquery.easyui.min.js"></script>

    <script>
        $(function () {
            jiazai();

        })

        function jiazai() {
            $.ajax({
                url: "http://localhost:25744/api/Auditing",
                type: "get",
                dataType: "json",
                success: function (data1) {
                    var msg = eval(data1);
                    $('#sh').datagrid('loadData', data1);
                }
            })
        }

        //操作栏
        function formatOper(val, row, index) {
            var s = "";
            if (row.basic_State == 92)
            {
                s = "<a href='#' onclick='sta(" + row.basic_id + "," + row.projectNumber + ")'>审核</a>";
            }
            return s;
        }

        //打开审核页面
        function sta(basic_id, projectNumber)
        {
            $('#shen').window('open');
            $("#basic_id").textbox("setValue", basic_id);
            $("#projectNumber").textbox("setValue", projectNumber);
        }
        
        //审核
        function guo(basic_State)
        {
            $.ajax({
                url: "http://localhost:25744/api/Auditing",
                type: "put",
                data: {
                    basic_id: $("#basic_id").val(),
                    basic_State: basic_State
                },
                success: function (sql) {
                    if (sql > 0) {
                        var auditing_State="";
                        if (basic_State == 93)
                        {
                            auditing_State = "审核通过";
                        }
                        else
                        {
                            auditing_State = "审核未通过";
                        }
                        $.ajax({
                            url: "http://localhost:25744/api/Auditing",
                            type: "post",
                            data: {
                                basic_id: $("#basic_id").val(),
                                projectNumber: $("#projectNumber").val(),
                                Auditing_Opinion: $("#Auditing_Opinion").val(),
                                auditing_Type: 1096,
                                auditing_CreatePeople: 1,
                                auditing_State: auditing_State
                            },
                            success: function (obj) {
                                if (sql > 0) {
                                    alert('审核成功');
                                    $('#shen').window('close');
                                    jiazai();
                                }
                                else {
                                    alert('审核失败')
                                }
                            }
                        })
                    }
                    else {
                        alert('审核失败')
                    }
                }
            })
        }

        function xiang() {
            var row = $('#sh').datagrid('getSelected');
            if (row) {
                $('#xiang').window('open');
                xiangqing(row.projectNumber);
            }
        }

        function xiangqing(projectNumber)
        {
            $.ajax({
                url: "http://localhost:25744/api/Auditing",
                type: "get",
                dataType: "json",
                data: { projectNumber: projectNumber },
                success: function (data1) {
                    var msg = eval(data1);
                    $('#xq').datagrid('loadData', data1);
                }
            })
        }

    </script>

</head>
<body class="bb1">
    <a href="javascript:void(0)" class="easyui-linkbutton" onclick="xiang()">详细审核信息</a>

    <!--审核管理-->
    <table class="easyui-datagrid" title="审核管理" data-options="singleSelect:true,collapsible:true" style="width:80%;height:70%" id="sh">
        <thead>
            <tr>
                <th data-options="field:'basic_id',width:80,align:'center'">项目号</th>
                <th data-options="field:'projectNumber',width:80,align:'center'">项目编号</th>
                <th data-options="field:'User_Id',width:80,align:'center'">申请人</th>
                <th data-options="field:'survey',width:80,align:'center'">勘察员</th>
                <th data-options="field:'evaluation',width:150,align:'center'">估价员</th>
                <th data-options="field:'house_Located',width:80,align:'center'">房屋坐落</th>
                <th data-options="field:'basic_Acreage',width:150,align:'center'">建筑面积(m³)</th>
                <th data-options="field:'basic_UnitPrice',width:80,align:'center'">评估单价(元/m³)</th>
                <th data-options="field:'basic_Total',width:80,align:'center'">评估总值(元)</th>
                <th data-options="field:'basic_State',width:80,align:'center'">项目状态</th>
                <th data-options="field:'_operate',width:80,align:'center',formatter:formatOper">操作</th>
            </tr>
        </thead>
    </table>
    <!--审核页面-->
    <div id="shen" class="easyui-window" title="审核页面" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:50%;height:90%;padding:10px;">
        <form id="ff" method="post">
            <table cellpadding="5">
                <tr hidden="hidden">
                    <td class="auto-style2">项目号</td>
                    <td class="auto-style1">
                        <input id="basic_id" class="easyui-textbox" type="text" name="name" data-options="required:true">
                    </td>
                </tr>
                <tr hidden="hidden">
                    <td class="auto-style2">项目编号</td>
                    <td class="auto-style1">
                        <input id="projectNumber" class="easyui-textbox" type="text" name="name" data-options="required:true">
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2">审核意见:</td>
                    <td class="auto-style1">
                        <input id="Auditing_Opinion" class="easyui-textbox" type="text" name="name" data-options="required:true">
                    </td>
                </tr>
                <tr>
                    <td class="auto-style2"></td>
                    <td class="auto-style1">
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="guo(93)" id="tian">审核通过</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="guo(1094)" id="tian">审核不通过</a>
                        <a href="javascript:void(0)" class="easyui-linkbutton" onclick="$('#shen').window('close')">取消</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>

    <!--审核详情页面-->
    <div id="xiang" class="easyui-window" title="审核详情页面" data-options="modal:true,closed:true,iconCls:'icon-save'" style="width:48%;height:90%;padding:10px;">
        <div style="margin:0 auto;height:100%">
            <table class="easyui-datagrid" title="审核详情" data-options="singleSelect:true,collapsible:true" style="width:100%;height:100%" id="xq">
                <thead>
                    <tr>
                        <th data-options="field:'ProjectNumber',width:80,align:'center'">项目编号</th>
                        <th data-options="field:'auditing_Time',width:120,align:'center'">审核日期</th>
                        <th data-options="field:'auditing_Type',width:80,align:'center'">审核类型</th>
                        <th data-options="field:'auditing_State',width:100,align:'center'">审核状态</th>
                        <th data-options="field:'auditing_CreatePeople',width:80,align:'center'">审核人</th>
                        <th data-options="field:'Auditing_Opinion',width:150,align:'center'">审核内容</th>
                </thead>
            </table>
        </div>
           
    </div>
</body>
</html>

